blob: c2c8051d0f75cd1ef531b6ef71673bdf943a802b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
import { get, auth, post } from '$lib/utils';
import { redirect } from '@sveltejs/kit';
export async function load({ cookies, params, parent }) {
let { user } = await parent();
let { name } = params;
let { amount } = await get(`/pot/${name}`);
if (!amount) throw redirect(307, `/pot/${name}`);
if (!user) throw redirect(307, `/register?redirect=/pot/${name}/sweep`);
await post('/take', { amount, name }, auth(cookies));
return { amount, name };
}
|